<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>用户管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/css/bootstrap.min.css"/>
</head>
<body>
<%@include file="/inc/menu.jsp"%>
<div class="container-fluid">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-12">
                <ul class="nav nav-tabs nav-3rd">
                    <li><span>用户管理</span></li>
                    <li><a href="${pageContext.request.contextPath}/admin/user/list">用户列表</a></li>
                    <li class="active">新增/修改用户信息</li>
                </ul>
            </div>
        </div>

        <div class="inner-content inner-content-left">
            <form action="${pageContext.request.contextPath}/admin/user/edit" method="post">
                <div class="form-group">
                    <label>用户账号<span class="required">*</span></label>
                    <c:if test="${user.id>0}">
                        <div>
                                ${user.username}
                            <div>
                                <input class="form-control" type="hidden" name="username" value="${user.username}"/>
                                <input class="form-control" type="hidden" name="id" value="${user.id}"/>
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${empty user.id}">
                        <div>
                            <input class="form-control" type="text" name="username" autofocus required/>
                        </div>
                    </c:if>
                </div>
                <div class="form-group">
                    <label>角色</label>

                    <div class="input-group">
                        <c:forEach items="${roleList}" var="role">
                            <input type="checkbox" name="rids" value="${role.id}"
                                    <c:if test="${user.roleList.contains(role)}">
                                        checked
                                    </c:if>
                                    />${role.name}
                        </c:forEach>
                    </div>
                </div>
                <div class="form-group">
                    <input type="submit" value="提交"/>
                    <%--<button class="btn btn-lg btn-block btn-primary"></button>--%>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>
